﻿
@{
    ViewData["Title"] = "Edit";
    Layout = "~/Views/Shared/_LayuiEdit.cshtml";
}
@model List<ZhCun.RightsManage.DBModel.Sys_Role>
    <form class="layui-form" lay-filter="form" onsubmit="return false;">
        <input type="hidden" name="Id" />
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="UserName" class="layui-input" lay-verify="required" placeholder="" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" name="MobileNumber" class="layui-input" lay-verify="required" placeholder="" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录名</label>
            <div class="layui-input-block">
                <input type="text" name="LoginName" class="layui-input" lay-verify="required" placeholder="" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">在线数量</label>
            <div class="layui-input-block">
                <input type="text" name="OnLineLoginNumber" class="layui-input" lay-verify="required" placeholder="" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">管理账户</label>
            <div class="layui-input-block">
                <select name="IsManage" lay-filter="roleSelected" lay-verify="required">
                    <option value="false">否</option>
                    <option value="true">是</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div class="layui-input-block">
                <select name="RoleId" lay-filter="roleSelected" lay-verify="required">
                    <option value=""></option>
                    @foreach (var item in Model)
                    {
                        <option value="@item.Id">@item.RoleName</option>
                    }
                </select>
            </div>
        </div>
        <input type="hidden" name="RoleName" />
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="save">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <button type="Button" class="layui-btn layui-btn-danger" onclick="closePage()">关闭</button>
            </div>
        </div>
    </form>
<script>
    addLayuiUseEvent(function () {
        form.on('select(roleSelected)',
            function (data) {
                var selectText = $("[name='RoleId'] option:selected").text();
                $("[name='RoleName']").val(selectText);
            });
    });
</script>